# -*- coding: UTF-8 -*-
import sys
import cv2.cv as cv
import time

fileName = 'alien-0.png'
image = cv.LoadImage(fileName, cv.CV_LOAD_IMAGE_COLOR)

col_edge = cv.CreateImage((image.width, image.height), 8, 3)

gray = cv.CreateImage((image.width, image.height), 8, 1)
edge = cv.CreateImage((image.width, image.height), 8, 1)
cv.CvtColor(image, gray, cv.CV_BGR2GRAY)

cv.NamedWindow('Output', cv.CV_WINDOW_AUTOSIZE)

cv.Smooth(gray, edge, cv.CV_BLUR, 3, 3, 0)
cv.Not(gray, edge)

cv.Canny(gray, edge, 100, 300, 3)

cv.SetZero(col_edge)

#cv.Copy(image, col_edge, edge)
cv.Copy(image, col_edge, edge)

#cv.ShowImage('Output', edge)
cv.ShowImage('Output', col_edge)

cv.WaitKey(0)